		<div id="connection_form" title="Connexion">
			<form>
				<fieldset>
					<label for="Login">Identifiant :</label>
					<input type="text" name="Login" id="Login" class="text ui-widget-content ui-corner-all" /><br />
					<label for="Password">Mot de passe :</label>
					<input type="password" name="Password" id="Password" value="" class="text ui-widget-content ui-corner-all" readonly="readonly" /><br /><br />
					Passez la souris sur un chiffre pour l'ajouter au mot de passe
					<table id="digit_table">
						<tr>
							<td></td>
							<td></td>
							<td></td>
							<td></td>
							<td></td>
						</tr>
						<tr>
							<td></td>
							<td></td>
							<td></td>
							<td></td>
							<td></td>
						</tr>
					</table>
					<br />
				</fieldset>
			</form>
			<p class="validateTips"></p>
		</div>
		<script>
		{literal}
			$(function() {
				$( "#dialog:ui-dialog" ).dialog( "destroy" );
				
				var login = $( "#Login" ),
					pass = $( "#Password" ),
					allFields = $( [] ).add( login ).add( pass ),
					tips = $( "#connection_form .validateTips" );
		
				function updateTips( t ) {
					tips
						.text( t )
						.addClass( "ui-state-highlight" );
					setTimeout(function() {
						tips.removeClass( "ui-state-highlight", 1500 );
					}, 500 );
				}
		
				function checkLength( o, n, min, max ) {
					if ( o.val().length > max || o.val().length < min ) {
						o.addClass( "ui-state-error" );
						updateTips( "La longueur du champs \"" + n + "\" doit être entre " +
							min + " et " + max + "." );
						return false;
					} else {
						return true;
					}
				}
		
				function checkRegexp( o, regexp, n ) {
					if ( !( regexp.test( o.val() ) ) ) {
						o.addClass( "ui-state-error" );
						updateTips( n );
						return false;
					} else {
						return true;
					}
				}
				
				$( "#connection_form" ).dialog({
					autoOpen: false,
					height: 500,
					width: 550,
					modal: true,
					buttons: {
						"Connexion": function() {
							var bValid = true;
							allFields.removeClass( "ui-state-error" );
		
							bValid = bValid && checkLength( login, "login", 10, 10 );
							bValid = bValid && checkLength( pass, "pass", 6, 6 );
		
							bValid = bValid && checkRegexp( login, /^[0-9]+$/i, "Le login est une chaine de 10 chiffres." );
							bValid = bValid && checkRegexp( pass, /^[0-9]+$/i, "Le mot de passe est une chaine de 6 chiffres." );
		
							if ( bValid ) {
								// Si les champs sont valides, faire une requête Ajax pour tenter de connecter l'utilisateur
								
								$.post( "{/literal}{url_to controller="user" action="connection"}{literal}", { connection_form: 0, login: login.val(), password: pass.val() },
										function(data){
											updateTips( data[1] ) ;
											
											if ( data[0] == 1 )
												setTimeout( function() {
														$( location ).attr( "href", "{/literal}{url_to controller="account"}{literal}" );
													},
													1000 );
										},
										"json");
								
							}
						},
						"Reset": function() {
							login.val( "" );
							pass.val( "" );
							allFields.val( "" ).removeClass( "ui-state-error" );
							tips.text( "" );
						},
						"Annuler": function() {
							$( this ).dialog( "close" );
						}
					},
					close: function() {
						allFields.val( "" ).removeClass( "ui-state-error" );
						tips.text( "" );
					},
					open: function() {
						var tab = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
						for( var i = 0 ; i < 10 ; i ++)
						{
							var alea = Math.floor( Math.random() * 10 ) % tab.length;
							$( "#digit_table td").eq( i ).text( tab[alea] );
							tab[alea] = tab[tab.length-1];
							tab.pop();
						}
					}
				});
		
				$( "#connection_button" )
					.click(function() {
						$( "#connection_form" ).dialog( "open" );
					});
				
				$( "#digit_table tr td" )
					.mouseover(function() {
						if ( pass.val().length < 6 )
							pass.val( pass.val() + $( this ).text() );
					});
				
			});
		{/literal}
		</script>